import requestService from "../service/request";

const Api = {
  getOpenId: "/appUser/getOpenId",
  login: "/appUser/miniProgramLogin",
  createOrder: "/appOrder/submitOrder",
  createResult: "/appOrder/submitOrderResult",
  Detail: "/product/getProduct",
  orderList: "/appOrder/orderPageList",
  orderDetail: "/appOrder/orderDetail",
};

//获取openid
export function getOpenId(data) {
  return requestService(Api.getOpenId, {
    type: "post",
    data,
    paramsFormdata: "application/x-www-form-urlencoded",
  });
}
//登录
export function loginByOpenId(data) {
  return requestService(Api.login, {
    type: "post",
    data,
    paramsFormdata: "application/x-www-form-urlencoded",
  });
}
//创建订单
export function createdOrder(data) {
  return requestService(Api.createOrder, {
    type: "post",
    data,
  });
}

//创建订单 支付结果
export function submitOrderResult(data) {
  return requestService(Api.createResult, {
    type: "post",
    data,
    paramsFormdata: "application/x-www-form-urlencoded",
  });
}

// 商品详情  商品Id
export function goodsDetail(data) {
  return requestService(Api.Detail, {
    type: "post",
    data,
    paramsFormdata: "application/x-www-form-urlencoded",
  });
}
export function orderList(data) {
  return requestService(Api.orderList, {
    type: "post",
    data,
  });
}
export function getOrderDetail(data) {
  return requestService(Api.orderDetail, {
    type: "post",
    data,
    paramsFormdata: "application/x-www-form-urlencoded",
  });
}

//删除自动回复 列表的某一项
// export function delAnswer(data) {
//   return requestService(Api.del, {
//     type: "post",
//     data,
//     paramsFormdata: "application/x-www-form-urlencoded",
//     // paramsFormdata: "application/x-www-form-urlencoded",
//   });
// }
